/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tpevol;

import java.util.ArrayList;
import java.util.Collection;
import tpgen.manchester.w3org.Construct;
import tpgen.patterns.TransformationPattern;

/**
 *
 * @author shanki
 */
public class TpEvol {
    

    public TransformationPattern calculate(int populationSize, int maxTime, double pRepro, double pMutate, int maxVarsPerType, int maxAxioms, int maxTransformations, Collection<Construct> inputForbiddenConstructs, Collection<Construct> outputForbiddenConstructs, Evaluator evaluator) {
        
        TpGa ga             = new TpGa(populationSize, maxTime, pRepro, pMutate, maxVarsPerType, maxAxioms, maxTransformations, inputForbiddenConstructs, outputForbiddenConstructs, evaluator);
        TpChromosome best   = ga.compute();
        
        return best.getTp();
    }    

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Evaluator eval      = new Evaluator() {

            @Override
            public double eval(String transformationPattern) {
//                if (transformationPattern.getPt().size() == 0) {
//                    return Double.MAX_VALUE;
//                } else
                {
                    return 42;
                }
            }
        };
       
        TpEvol evol                 = new TpEvol();
        TransformationPattern tp    = evol.calculate(100, 100, 0.5, 0.5, 10,10,10, new ArrayList<Construct>(), new ArrayList<Construct>(), eval);
        
        System.out.println(tp);
    }
}